package me.zfz.business.utils;

import java.util.ArrayList;
import java.util.List;

import me.zfz.base.bean.TreeProp;
import me.zfz.business.bean.entity.TNOrg;

/**
 * @author author
 */
public class TreeUtil {

    /**
     * 学院树转化为TreeProp对象树
     *
     * @param orgTrees 学院实体树列表
     * @return　返回转换后的TreeProp列表
     */
    public static List<TreeProp> Org2TreeProp(List<TNOrg> orgTrees) {
        List<TreeProp> treeProps = null;
        if (null != orgTrees && orgTrees.size() > 0) {
            treeProps = new ArrayList<TreeProp>();
            TreeProp treeProp = null;
            for (TNOrg org : orgTrees) {
                treeProp = new TreeProp();
                treeProp.setId(org.getId());
                treeProp.setName(org.getName());
                treeProp.setParentId(org.getParentId());
                treeProp.setSortOrder(org.getSortOrder());
                treeProp.setFlag(org.getType());
                treeProps.add(treeProp);
            }
            treeProp = null;
        }
        orgTrees = null;
        return treeProps;
    }

}
